<template>
  <BasicModal
    v-bind="$attrs"
    title="学生成绩详情"
    width="700px"
    @ok="closeModal"
    @register="registerModal"
  >
    <Description @register="registerDesc" :column="2" />
  </BasicModal>
</template>

<script lang="ts" setup>
  import { ref } from "vue";
  import { BasicModal, useModalInner } from "/@/components/Modal";
  import { Description, useDescription } from "/@/components/Description";
  import { reportDescSchema } from "/@/views/teacher/practical/member/member.data";

  const descData = ref({});

  const [registerModal, { closeModal }] = useModalInner((data) => {
    data.total = Math.round(
      data.groupScore * 0.1 +
        ((data.schLessonPlan + data.univLessonPlan) / 2) * 0.1 +
        ((data.schLeaderWork + data.univLeaderWork) / 2) * 0.2 +
        ((data.schLectureNote + data.univLectureNote) / 2) * 0.1 +
        ((data.schTeacherMoral + data.univTeacherMoral) / 2) * 0.15 +
        ((data.schTeachingStudy + data.univTeachingStudy) / 2) * 0.15 +
        ((data.schClassroomTeaching + data.univClassroomTeaching) / 2) * 0.2,
    );
    descData.value = data;
  });

  const [registerDesc] = useDescription({
    data: descData,
    schema: reportDescSchema,
  });
</script>
